/**
 * @file debug_print.h
 * @Synopsis
 * @author xing.dai@aliyun.com
 * @version 0.0.1
 * @date 2018-08-01
 */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __DEBUG_PRINT_H__
#define __DEBUG_PRINT_H__

/* Includes ------------------------------------------------------------------*/
#include "includes.h"
/* Exported types ------------------------------------------------------------*/
enum LOG_LEVEL {
    CRITICAL_LEVEL = 0,
    ERROR_LEVEL,
    NORMAL_LEVEL,
    INFO_LEVEL,
    DEBUG_LEVEL,
};

enum {
    SHOW_STAMP = 0,
    NONE_SHOW_STAMP,
};
/* Exported constants --------------------------------------------------------*/

/* Exported macro ------------------------------------------------------------*/
#define dbg0(x_format, ...)		dbg_printf(CRITICAL_LEVEL, SHOW_STAMP, x_format, ##__VA_ARGS__)
#define dbg1(x_format, ...)		dbg_printf(ERROR_LEVEL, SHOW_STAMP, x_format, ##__VA_ARGS__)
#define dbg2(x_format, ...)		dbg_printf(NORMAL_LEVEL, SHOW_STAMP, x_format, ##__VA_ARGS__)
#define dbg3(x_format, ...)		dbg_printf(INFO_LEVEL, SHOW_STAMP, x_format, ##__VA_ARGS__)
#define dbg4(x_format, ...)		dbg_printf(DEBUG_LEVEL, SHOW_STAMP, x_format, ##__VA_ARGS__)

#define dbg_red(x_format, ...)			dbg_printf(CRITICAL_LEVEL, NONE_SHOW_STAMP, x_format, ##__VA_ARGS__)
#define dbg_purple(x_format, ...)		dbg_printf(ERROR_LEVEL, NONE_SHOW_STAMP, x_format, ##__VA_ARGS__)
#define dbg_white(x_format, ...)		dbg_printf(NORMAL_LEVEL, NONE_SHOW_STAMP, x_format, ##__VA_ARGS__)
#define dbg_green(x_format, ...)		dbg_printf(INFO_LEVEL, NONE_SHOW_STAMP, x_format, ##__VA_ARGS__)
#define dbg_yellow(x_format, ...)		dbg_printf(DEBUG_LEVEL, NONE_SHOW_STAMP, x_format, ##__VA_ARGS__)

#define show_info(x_format, ...)	dbg_white(x_format, ##__VA_ARGS__)
/* Exported variables --------------------------------------------------------*/
extern uint8 g_dbg_mask;

/* Exported functions ------------------------------------------------------- */
unsigned int dbg_printf(uint32 level, int stamp, const char *x_format, ...);

#endif /* __DEBUG_PRINT_H__ */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
